import 'package:hktk_app/model/yidun/ios_widget_model.dart';

/// 网易易盾一键登录iOS自定义页面对应模型
class IosConfigModel {
  // <======================= 基础配置 =======================>

  /// 设置授权页面背景颜色
  String? backgroundColor;

  /// 设置窗口类型
  /// - 0 表示全屏模式
  /// - 1 表示窗口在屏幕的中间
  /// - 2 表示窗口在屏幕的底部(不支持横屏)
  int? authWindowPop;

  /// 设置授权页面方向
  /// - 0 表示竖屏
  /// - 1 表示左横屏
  /// - 2 表示右横屏
  /// - 3 表示左右横屏
  /// - 4 表示屏幕全旋转
  int? faceOrientation;

  /// 设置授权转背景图片，例如 ："图片名.后缀"
  String? bgImage;

  /// 设置背景图片显示模式
  /// - 0 表示 UIViewContentModeScaleToFill
  /// - 1 表示UIViewContentModeScaleAspectFit
  /// - 2 表示UIViewContentModeScaleAspectFill
  int? contentMode;

  // <======================= 转场动画 =======================>

  /// 设置授权转场动画
  /// - 0 表示下推
  /// - 1 表示翻转
  /// - 2 表示淡出
  int? modalTransitionStyle;

  // <======================= 自定义控件 =======================>

  /// 自定义控件<br>
  /// 自定义view数组
  List<IosWidgetModel>? widgets;

  // <======================= 背景设置视频 =======================>

  /// 设置视频本地名称 例如xx.mp4*
  String? localVideoFileName;

  /// 设置是否重复播放视频，
  /// - YES 表示重复播放，
  /// - NO 表示不重复播放
  String? isRepeatPlay;

  /// 设置网络视频的地址
  String? videoURL;

  // <======================= 背景设置 Gif =======================>

  /// 设置动画重复的次数 -1无限重复
  int? animationRepeatCount;

  /// 设置图片数组
  List<String>? animationImages;

  /// 设置动画的时长
  int? animationDuration;

  // <======================= 导航栏 =======================>

  /// 导航栏是否隐藏
  bool? navBarHidden;

  /// 设置导航栏背景颜色
  String? navBgColor;

  /// 设置导航栏标题
  String? navText;

  /// 设置导航栏标题字体大小
  double? navTextFont;

  /// 设置导航栏标题字体颜色
  String? navTextColor;

  /// 设置导航栏标题是否隐藏，默认不隐藏
  bool? navTextHidden;

  /// 设置导航返回图标，例如："back-1"
  String? navReturnImg;

  /// 设置导航返回图标距离屏幕左边的距离，默认0
  double? navReturnImgLeftMargin;

  /// 设置导航返回图标距离屏幕底部的距离，默认0
  double? navReturnImgBottomMargin;

  /// 设置导航返回图标的宽度，默认44
  double? navReturnImgWidth;

  /// 设置导航返回图标的高度 , 默认44
  double? navReturnImgHeight;

  // <======================= 应用 Logo =======================>

  /// 设置logo图片, 例如 ："图片名.后缀"]
  String? logoIconName;

  /// 设置logo图片宽度
  double? logoWidth;

  /// 设置logo图片高度
  double? logoHeight;

  /// 设置logo图片沿Y轴偏移量，<br>
  /// logoOffsetTopY为距离屏幕顶部的距离 ，默认为20
  double? logoOffsetTopY;

  /// 设置logo图片沿X轴偏移量，<br>
  /// logoOffsetX = 0居中显示
  double? logoOffsetX;

  /// 设置logo图片是否隐藏，默认不隐藏
  bool? logoHidden;

  // <======================= 手机掩码 =======================>

  /// 设置手机号码字体颜色
  String? numberColor;

  /// 设置手机号码字体大小， 默认18
  double? numberFont;

  /// 设置手机号码沿Y轴偏移量，<br>
  /// numberOffsetTopY为距离屏幕顶部的距离 ，默认为100
  double? numberOffsetTopY;

  /// 设置手机号码沿X轴偏移量，<br>
  /// numberOffsetX = 0居中显示
  double? numberOffsetX;

  /// 设置手机号码框的高度 默认27
  double? numberHeight;

  /// 设置手机号码的背景颜色
  String? numberBackgroundColor;

  /// 设置手机号码的控件的圆角
  double? numberCornerRadius;

  /// 设置手机号码的左边描述内容，默认为空
  String? numberLeftContent;

  /// 设置手机号码的右边描述内容，默认为空色
  String? numberRightContent;

  // <======================= 认证品牌 =======================>

  /// 设置认证服务品牌文字颜色
  String? brandColor;

  /// 设置认证服务品牌背景颜色
  String? brandBackgroundColor;

  /// 设置认证服务品牌文字字体 默认12
  double? brandFont;

  /// 设置认证服务品牌的宽度， 默认200
  double? brandWidth;

  /// 设置认证服务品牌的高度， 默认16
  double? brandHeight;

  /// 设置认证服务品牌X偏移量 ，<br>
  /// brandOffsetX = 0居中显示
  double? brandOffsetX;

  /// 设置认证服务品牌Y偏移量,<br>
  /// brandOffsetTopY为距离屏幕顶部的距离 ，默认为150
  double? brandOffsetTopY;

  /// 设置是否隐藏认证服务品牌，默认显示
  bool? brandHidden;

  // <======================= 登录按钮 =======================>

  /// 设置登录按钮文本
  String? logBtnText;

  /// 设置登录按钮字体大小
  double? loginBtnTextSize;

  /// 设置登录按钮文本颜色
  String? logBtnTextColor;

  /// 设置登录按钮Y偏移量.<br>
  /// logBtnOffsetTopY为距离屏幕顶部的距离 ，默认为200
  double? logBtnOffsetTopY;

  /// 设置登录按钮圆角，默认8
  double? logBtnRadius;

  /// 设置登录按钮背景颜色
  String? logBtnUsableBGColor;

  /// 设置登录按钮可用状态下的背景图片
  String? logBtnEnableImg;

  /// 登录按钮高亮状态下的背景图片
  String? logBtnHighlightedImg;

  /// 登录按钮的左边距 ，横屏默认40 ，竖屏默认260
  double? logBtnOriginLeft;

  /// 设置登录按钮的左边距，横屏默认40 ，竖屏默认260
  double? logBtnOriginRight;

  /// 设置登录按钮的高度，默认44
  double? logBtnHeight;

  // <======================= 隐私协议 =======================>
  // 若勾选框需要展示，请务必设置勾选框的选中态图片与未选中态图片
  // 协议未勾选时，登录按钮是否可点击可以自定义设置，弹窗提示的样式也可以自定义

  /// 图片名
  String? unCheckedImageName;

  /// 图片名
  String? checkedImageName;

  /// 设置复选框大小（只能正方形) ，默认 12
  double? checkboxWH;

  /// 设置复选框默认状态 默认:NO
  String? privacyState;

  /// 设置隐私条款check框位置
  ///- 0 表示相对协议顶对齐
  ///- 1 表示相对协议中对齐
  ///- 2 表示相对协议下对齐 默认顶对齐
  int? checkBoxAlignment;

  /// 设置复选框勾选状态，
  /// - YES:勾选，
  /// - NO:取消勾选状态
  String? checkedSelected;

  /// 设置复选框距离隐私条款的边距 默认 8
  double? checkBoxMargin;

  /// 设置隐私条款距离屏幕左边的距离 默认 60
  double? appPrivacyOriginLeftMargin;

  /// 设置隐私条款距离屏幕右边的距离 默认 40
  double? appPrivacyOriginRightMargin;

  /// 设置隐私条款距离屏幕的距离 默认 40
  double? appPrivacyOriginBottomMargin;

  /// 设置用户协议界面，导航栏返回图标，默认用导航栏返回图标
  String? privacyNavReturnImg;

  /// 设置隐私的内容模板：<br>
  /// > 全句可自定义但必须保留"《默认》"字段表明SDK默认协议,否则设置不生效。<br>
  ///
  /// 必设置项（参考SDK的demo）appPrivacyText设置内容：<br>
  /// > 登录并同意《默认》和易盾协议1、网易协议2登录并支持一键登录，<br>
  ///
  /// 展示：<br>
  /// > 登录并同意中国移动条款协议和易盾协议1、网易协议2登录并支持一键登录<br>
  String? appPrivacyText;

  /// 设置开发者隐私条款协议名称（第一个协议）
  String? appFPrivacyText;

  /// 设置开发者隐私条款协议url（第一个协议）
  String? appFPrivacyURL;

  /// 设置开发者隐私条款协议名称（第二个协议）
  String? appSPrivacyText;

  /// 设置开发者隐私条款协议url（第二个协议）
  String? appSPrivacyURL;

  /// 设置是否隐藏"《默认》" 两边的《》，默认不隐藏
  bool? shouldHiddenPrivacyMarks;

  /// 设置隐私条款名称颜色
  String? privacyColor;

  /// 设置隐私条款字体的大小
  double? privacyFont;

  /// 设置协议条款协议名称颜色
  String? protocolColor;

  /// 设置隐私协议的行间距, 默认是1
  double? appPrivacyLineSpacing;

  /// 设置隐私协议的字间距, 默认是0
  double? appPrivacyWordSpacing;

  /// 设置用户协议界面，进度条颜色
  String? progressColor;

  /// - 0 显示自定义提示框
  /// - 1 显示系统提示框
  /// - 2 隐藏提示框
  int? showPrivacyDialog;

  // <======================= 弹窗模式 =======================>

  /// 设置窗口模式的背景颜色
  String? popBackgroundColor;

  /// 设置弹窗的宽度，竖屏状态下默认是 300，横屏状态下默认是 335
  double? authWindowWidth;

  /// 设置弹窗高度，竖屏状态下默认是335， 横屏状态下默认是300 <br>
  /// ⚠️底部半屏弹窗模式的高度可通过修改 authWindowHeight，调整高度 默认335pt
  double? authWindowHeight;

  /// 设置弹窗模式下关闭按钮的图片，⚠️(必传)
  String? closePopImg;

  /// 设置弹窗模式下关闭按钮图片的宽度 默认20*
  double? closePopImgWidth;

  /// 设置弹窗模式下关闭按钮图片的高度 默认20
  double? closePopImgHeight;

  /// 设置关闭按钮距离顶部的距离，默认距离顶部10，距离 = 10 + closePopImgOriginY
  double? closePopImgOriginY;

  /// 设置关闭按钮距离父视图右边的距离，默认距离为10，距离 = 10 + closePopImgOriginX
  double? closePopImgOriginX;

  /// 设置居中弹窗沿Y轴移动的距离。例如 ：authWindowCenterOriginY = 10 表示中间点沿Y轴向下偏移10个像素
  double? authWindowCenterOriginY;

  /// 设置居中弹窗沿X轴移动的距离。例如 ：authWindowCenterOriginX = 10 表示中间点沿X轴向右偏移10个像素
  double? authWindowCenterOriginX;

  /// 设置居中弹窗模式下，弹窗的圆角，默认圆角为16
  double? popCenterCornerRadius;

  /// 设置底部弹窗模式下，弹窗的圆角，默认圆角为16，注：只可修改顶部左右二边的值
  double? popBottomCornerRadius;

  /// 设置底部弹窗模式下，是否开启轻扫手势，向下轻扫关闭弹窗。默认关闭
  bool? isOpenSwipeGesture;

  /// 网易易盾一键登录iOS自定义页面对应模型
  IosConfigModel({
    this.backgroundColor,
    this.authWindowPop,
    this.faceOrientation,
    this.bgImage,
    this.contentMode,
    this.modalTransitionStyle,
    this.widgets,
    this.localVideoFileName,
    this.isRepeatPlay,
    this.videoURL,
    this.animationRepeatCount,
    this.animationImages,
    this.animationDuration,
    this.navBarHidden,
    this.navBgColor,
    this.navText,
    this.navTextFont,
    this.navTextColor,
    this.navTextHidden,
    this.navReturnImg,
    this.navReturnImgLeftMargin,
    this.navReturnImgBottomMargin,
    this.navReturnImgWidth,
    this.navReturnImgHeight,
    this.logoIconName,
    this.logoWidth,
    this.logoHeight,
    this.logoOffsetTopY,
    this.logoOffsetX,
    this.logoHidden,
    this.numberColor,
    this.numberFont,
    this.numberOffsetTopY,
    this.numberOffsetX,
    this.numberHeight,
    this.numberBackgroundColor,
    this.numberCornerRadius,
    this.numberLeftContent,
    this.numberRightContent,
    this.brandColor,
    this.brandBackgroundColor,
    this.brandFont,
    this.brandWidth,
    this.brandHeight,
    this.brandOffsetX,
    this.brandOffsetTopY,
    this.brandHidden,
    this.logBtnText,
    this.loginBtnTextSize,
    this.logBtnTextColor,
    this.logBtnOffsetTopY,
    this.logBtnRadius,
    this.logBtnUsableBGColor,
    this.logBtnEnableImg,
    this.logBtnHighlightedImg,
    this.logBtnOriginLeft,
    this.logBtnOriginRight,
    this.logBtnHeight,
    this.unCheckedImageName,
    this.checkedImageName,
    this.checkboxWH,
    this.privacyState,
    this.checkBoxAlignment,
    this.checkedSelected,
    this.checkBoxMargin,
    this.appPrivacyOriginLeftMargin,
    this.appPrivacyOriginRightMargin,
    this.appPrivacyOriginBottomMargin,
    this.privacyNavReturnImg,
    this.appPrivacyText,
    this.appFPrivacyText,
    this.appFPrivacyURL,
    this.appSPrivacyText,
    this.appSPrivacyURL,
    this.shouldHiddenPrivacyMarks,
    this.privacyColor,
    this.privacyFont,
    this.protocolColor,
    this.appPrivacyLineSpacing,
    this.appPrivacyWordSpacing,
    this.progressColor,
    this.showPrivacyDialog,
    this.popBackgroundColor,
    this.authWindowWidth,
    this.authWindowHeight,
    this.closePopImg,
    this.closePopImgWidth,
    this.closePopImgHeight,
    this.closePopImgOriginY,
    this.closePopImgOriginX,
    this.authWindowCenterOriginY,
    this.authWindowCenterOriginX,
    this.popCenterCornerRadius,
    this.popBottomCornerRadius,
    this.isOpenSwipeGesture,
  });

  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = <String, dynamic>{};
    // 基础配置
    if (backgroundColor != null) {
      data["backgroundColor"] = backgroundColor;
    }
    if (authWindowPop != null) {
      data["authWindowPop"] = authWindowPop;
    }
    if (faceOrientation != null) {
      data["faceOrientation"] = faceOrientation;
    }
    if (bgImage != null) {
      data["bgImage"] = bgImage;
    }
    if (contentMode != null) {
      data["contentMode"] = contentMode;
    }
    // 转场动画
    if (modalTransitionStyle != null) {
      data["modalTransitionStyle"] = modalTransitionStyle;
    }
    // 自定义控件
    if (widgets != null) {
      data["widgets"] = widgets!.map((v) => v.toJson()).toList();
    }
    // 背景设置视频
    if (localVideoFileName != null) {
      data["localVideoFileName"] = localVideoFileName;
    }
    if (isRepeatPlay != null) {
      data["isRepeatPlay"] = isRepeatPlay;
    }
    if (videoURL != null) {
      data["videoURL"] = videoURL;
    }
    // 背景设置 Gif
    if (animationRepeatCount != null) {
      data["animationRepeatCount"] = animationRepeatCount;
    }
    if (animationImages != null) {
      data["animationImages"] = animationImages;
    }
    if (animationDuration != null) {
      data["animationDuration"] = animationDuration;
    }
    // 导航栏
    if (navBarHidden != null) {
      data["navBarHidden"] = navBarHidden;
    }
    if (navBgColor != null) {
      data["navBgColor"] = navBgColor;
    }
    if (navText != null) {
      data["navText"] = navText;
    }
    if (navTextFont != null) {
      data["navTextFont"] = navTextFont;
    }
    if (navTextColor != null) {
      data["navTextColor"] = navTextColor;
    }
    if (navTextHidden != null) {
      data["navTextHidden"] = navTextHidden;
    }
    if (navReturnImg != null) {
      data["navReturnImg"] = navReturnImg;
    }
    if (navReturnImgLeftMargin != null) {
      data["navReturnImgLeftMargin"] = navReturnImgLeftMargin;
    }
    if (navReturnImgBottomMargin != null) {
      data["navReturnImgBottomMargin"] = navReturnImgBottomMargin;
    }
    if (navReturnImgWidth != null) {
      data["navReturnImgWidth"] = navReturnImgWidth;
    }
    if (navReturnImgHeight != null) {
      data["navReturnImgHeight"] = navReturnImgHeight;
    }
    // 应用 Logo
    if (logoIconName != null) {
      data["logoIconName"] = logoIconName;
    }
    if (logoWidth != null) {
      data["logoWidth"] = logoWidth;
    }
    if (logoHeight != null) {
      data["logoHeight"] = logoHeight;
    }
    if (logoOffsetTopY != null) {
      data["logoOffsetTopY"] = logoOffsetTopY;
    }
    if (logoOffsetX != null) {
      data["logoOffsetX"] = logoOffsetX;
    }
    if (logoHidden != null) {
      data["logoHidden"] = logoHidden;
    }
    // 手机掩码
    if (numberColor != null) {
      data["numberColor"] = numberColor;
    }
    if (numberFont != null) {
      data["numberFont"] = numberFont;
    }
    if (numberOffsetTopY != null) {
      data["numberOffsetTopY"] = numberOffsetTopY;
    }
    if (numberOffsetX != null) {
      data["numberOffsetX"] = numberOffsetX;
    }
    if (numberHeight != null) {
      data["numberHeight"] = numberHeight;
    }
    if (numberBackgroundColor != null) {
      data["numberBackgroundColor"] = numberBackgroundColor;
    }
    if (numberCornerRadius != null) {
      data["numberCornerRadius"] = numberCornerRadius;
    }
    if (numberLeftContent != null) {
      data["numberLeftContent"] = numberLeftContent;
    }
    if (numberRightContent != null) {
      data["numberRightContent"] = numberRightContent;
    }
    // 认证品牌
    if (brandColor != null) {
      data["brandColor"] = brandColor;
    }
    if (brandBackgroundColor != null) {
      data["brandBackgroundColor"] = brandBackgroundColor;
    }
    if (brandFont != null) {
      data["brandFont"] = brandFont;
    }
    if (brandWidth != null) {
      data["brandWidth"] = brandWidth;
    }
    if (brandHeight != null) {
      data["brandHeight"] = brandHeight;
    }
    if (brandOffsetX != null) {
      data["brandOffsetX"] = brandOffsetX;
    }
    if (brandOffsetTopY != null) {
      data["brandOffsetTopY"] = brandOffsetTopY;
    }
    if (brandHidden != null) {
      data["brandHidden"] = brandHidden;
    }
    // 登录按钮
    if (logBtnText != null) {
      data["logBtnText"] = logBtnText;
    }
    if (loginBtnTextSize != null) {
      data["loginBtnTextSize"] = loginBtnTextSize;
    }
    if (logBtnTextColor != null) {
      data["logBtnTextColor"] = logBtnTextColor;
    }
    if (logBtnOffsetTopY != null) {
      data["logBtnOffsetTopY"] = logBtnOffsetTopY;
    }
    if (logBtnRadius != null) {
      data["logBtnRadius"] = logBtnRadius;
    }
    if (logBtnUsableBGColor != null) {
      data["logBtnUsableBGColor"] = logBtnUsableBGColor;
    }
    if (logBtnEnableImg != null) {
      data["logBtnEnableImg"] = logBtnEnableImg;
    }
    if (logBtnHighlightedImg != null) {
      data["logBtnHighlightedImg"] = logBtnHighlightedImg;
    }
    if (logBtnOriginLeft != null) {
      data["logBtnOriginLeft"] = logBtnOriginLeft;
    }
    if (logBtnOriginRight != null) {
      data["logBtnOriginRight"] = logBtnOriginRight;
    }
    if (logBtnHeight != null) {
      data["logBtnHeight"] = logBtnHeight;
    }
    // 隐私协议
    if (unCheckedImageName != null) {
      data["unCheckedImageName"] = unCheckedImageName;
    }
    if (checkedImageName != null) {
      data["checkedImageName"] = checkedImageName;
    }
    if (checkboxWH != null) {
      data["checkboxWH"] = checkboxWH;
    }
    if (privacyState != null) {
      data["privacyState"] = privacyState;
    }
    if (checkBoxAlignment != null) {
      data["checkBoxAlignment"] = checkBoxAlignment;
    }
    if (checkedSelected != null) {
      data["checkedSelected"] = checkedSelected;
    }
    if (checkBoxMargin != null) {
      data["checkBoxMargin"] = checkBoxMargin;
    }
    if (appPrivacyOriginLeftMargin != null) {
      data["appPrivacyOriginLeftMargin"] = appPrivacyOriginLeftMargin;
    }
    if (appPrivacyOriginRightMargin != null) {
      data["appPrivacyOriginRightMargin"] = appPrivacyOriginRightMargin;
    }
    if (appPrivacyOriginBottomMargin != null) {
      data["appPrivacyOriginBottomMargin"] = appPrivacyOriginBottomMargin;
    }
    if (privacyNavReturnImg != null) {
      data["privacyNavReturnImg"] = privacyNavReturnImg;
    }
    if (appPrivacyText != null) {
      data["appPrivacyText"] = appPrivacyText;
    }
    if (appFPrivacyText != null) {
      data["appFPrivacyText"] = appFPrivacyText;
    }
    if (appFPrivacyURL != null) {
      data["appFPrivacyURL"] = appFPrivacyURL;
    }
    if (appSPrivacyText != null) {
      data["appSPrivacyText"] = appSPrivacyText;
    }
    if (appSPrivacyURL != null) {
      data["appSPrivacyURL"] = appSPrivacyURL;
    }
    if (shouldHiddenPrivacyMarks != null) {
      data["shouldHiddenPrivacyMarks"] = shouldHiddenPrivacyMarks;
    }
    if (privacyColor != null) {
      data["privacyColor"] = privacyColor;
    }
    if (privacyFont != null) {
      data["privacyFont"] = privacyFont;
    }
    if (protocolColor != null) {
      data["protocolColor"] = protocolColor;
    }
    if (appPrivacyLineSpacing != null) {
      data["appPrivacyLineSpacing"] = appPrivacyLineSpacing;
    }
    if (appPrivacyWordSpacing != null) {
      data["appPrivacyWordSpacing"] = appPrivacyWordSpacing;
    }
    if (progressColor != null) {
      data["progressColor"] = progressColor;
    }
    if (showPrivacyDialog != null) {
      data["showPrivacyDialog"] = showPrivacyDialog;
    }
    // 弹窗模式
    if (popBackgroundColor != null) {
      data["popBackgroundColor"] = popBackgroundColor;
    }
    if (authWindowWidth != null) {
      data["authWindowWidth"] = authWindowWidth;
    }
    if (authWindowHeight != null) {
      data["authWindowHeight"] = authWindowHeight;
    }
    if (closePopImg != null) {
      data["closePopImg"] = closePopImg;
    }
    if (closePopImgWidth != null) {
      data["closePopImgWidth"] = closePopImgWidth;
    }
    if (closePopImgHeight != null) {
      data["closePopImgHeight"] = closePopImgHeight;
    }
    if (closePopImgOriginY != null) {
      data["closePopImgOriginY"] = closePopImgOriginY;
    }
    if (closePopImgOriginX != null) {
      data["closePopImgOriginX"] = closePopImgOriginX;
    }
    if (authWindowCenterOriginY != null) {
      data["authWindowCenterOriginY"] = authWindowCenterOriginY;
    }
    if (authWindowCenterOriginX != null) {
      data["authWindowCenterOriginX"] = authWindowCenterOriginX;
    }
    if (popCenterCornerRadius != null) {
      data["popCenterCornerRadius"] = popCenterCornerRadius;
    }
    if (popBottomCornerRadius != null) {
      data["popBottomCornerRadius"] = popBottomCornerRadius;
    }
    if (isOpenSwipeGesture != null) {
      data["isOpenSwipeGesture"] = isOpenSwipeGesture;
    }
    return data;
  }
}
